<template>
	<view class="content">
		<tn-nav-bar backgroundColor="#d4f1e8" fixed :height="45" :isBack="false">
			<view class="tn-flex title">
				<view class="navbar">
					<text class="tn-color-black" style="font-weight: bold;">消息通知</text>
				</view>
			</view>
		</tn-nav-bar>

		<!-- 消息 -->
		<view>
			<view class="notice">
				<block v-for="(item, index) in list" :key="index">
					<view class="card" @click="toMessagelist(index)">
						<tn-list-view :card="true">
							<view class="card-con">
								<view class="avatar">
									<tn-avatar :src="item.url"></tn-avatar>
								</view>
								<view class="message">
									<view class="msg-top">
										<view class="nickname">{{item.title}}</view>
										<view class="tn-color-gray" style="font-size: 24rpx;padding: 10rpx;">昨天12:23
										</view>
									</view>
									<view class="msg-bottom">
										<view class="msg tn-color-gray">
											<text>{{item.content}}</text>
										</view>
									</view>
								</view>
							</view>

						</tn-list-view>
					</view>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						title: '系统通知',
						url: 'https://pic.616pic.com/ys_img/00/04/84/NemA07oD6w.jpg',
						content: '测试公告',
					},
					{
						title: '提现通知',
						url: 'https://img1.baidu.com/it/u=3596997098,3740472341&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
						content: '您的提现款项已到账，请查收。',
					},
					{
						title: '消息通知',
						url: 'https://bpic.588ku.com/element_origin_min_pic/01/19/62/91570b5c17a3931.jpg',
						content: '您收到了n条消息',
					},
				]
			}
		},
		onLoad() {

		},
		methods: {
			toMessagelist(e) {
				console.log(e);
				if (e == 0) {
					uni.navigateTo({
						url: '/pages/system/system',
					});
				};
				if (e == 1) {
					uni.navigateTo({
						url: '../withdrawal/index',
					});
				};
				if (e == 2) {
					uni.navigateTo({
						url: '../news/index',
					});
				}
			}
		}
	}
</script>

<style lang="scss">
	.content {
		width: 100%;
		box-sizing: border-box;
	}

	.title {
		display: flex;
		align-items: center;
		padding-right: 188rpx;
		justify-content: center;
	}

	.title-t {
		margin-left: 10rpx;
		font-weight: 600;
		font-size: 32rpx;
	}

	.navbar {
		position: relative;
		width: 80vw;
		padding: 0 40rpx;
		display: flex;
	}

	.notice {
		box-sizing: border-box;
		padding-top: calc(2.5rem + env(safe-area-inset-top));
		margin-top: 5rpx;
	}

	.notice .tn-list-view {
		padding: 30rpx;
	}

	.notice .tn-flex {
		justify-content: space-between;
		align-items: center;
	}

	.card {
		margin-top: 20rpx;
	}

	.card-con {
		position: relative;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.avatar .tn-avatar {
		width: 80rpx;
		height: 80rpx;
	}

	.message {
		flex: 1;
		margin-left: 20rpx;
		line-height: 1;
	}

	.msg-top {
		width: 100%;
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
	}

	.nickname {
		font-size: 32rpx;
	}

	.msg-bottom {
		width: 100%;
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
	}

	.msg {
		height: 1em;
		overflow: hidden;
		margin-right: 80rpx;
	}
</style>